<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
    <head th:replace="_fragments :: head(~{::title})">
        <meta charset="UTF-8">
        <title>博客详情</title>
        <!--浏览器移动端预览-->
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <link rel="stylesheet" href="../static/css/typo.css" th:href="@{/css/typo.css}">
        <link rel="stylesheet" href="../static/css/semantic.min.css" th:href="@{/css/semantic.min.css}">
        <link rel="stylesheet" href="../static/css/animate.css" th:href="@{/css/animate.css}">
        <link rel="stylesheet" href="../static/css/prism.css" th:href="@{/css/prism.css}">
        <link rel="stylesheet" href="../static/libs/tocbot/tocbot.css" th:href="@{/libs/tocbot/tocbot.css}">

        <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    </head>
    <body>
        <!--首部-->
        <nav th:replace="_fragments :: menu(1)" class="ui inverted attached segment m-padded-tb-mini m-opacity-mini m-shadow-small">
            <div class="ui container">
                <div class="ui inverted secondary stackable menu">
                    <h2 class="ui teal header item">天乔巴夏</h2>
                    <!--menu-->
                    <a href="index.html" class="m-item item m-mobile-hide"><i class="archive icon"></i>首页</a>
                    <a href="type.html" class="m-item item m-mobile-hide"><i class="idea icon "></i>分类</a>
                    <a href="tags.html" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
                    <a href="archives.html" class="m-item item m-mobile-hide"><i class="clone icon"></i>归档</a>
                    <a href="aboutme.html" class="m-item item m-mobile-hide"><i class="user icon"></i>关于我</a>
                    <!--search box-->
                    <div class="right item">
                        <div class="ui icon input">
                            <input type="text" placeholder="搜索">
                            <i class="search link icon"></i>
                        </div>
                    </div>
                </div>
            </div>
            <a href="#" id="side" class="ui inverted icon button m-top-right m-mobile-show">
                <i class="sidebar icon"></i>
            </a>
        </nav>

        <!--中间部分-->
        <div id="waypoint" class="m-container-large m-padded-tb-big animate__animated animate__fadeIn">
            <div class="ui container">
                <div class="ui top attached segment">
                    <!--点赞数 评论数-->
                    <div class="ui grid">
                        <div class="thirteen wide column">
                            <div class="ui horizontal link list">
                                <div class="item">
                                    <img src="../static/images/example.jpg" th:src="@{/images/example.jpg}" alt=""
                                         class="ui avatar image">
                                    <div class="content"><a href="#" class="header">天乔巴夏</a></div>

                                </div>
                                <div class="item">
                                    <i class="calendar icon"></i> 2020-05-23
                                </div>
                                <div class="item">
                                    <i class="icon comment"></i> 20
                                </div>
                                <div class="item">
                                    <i class="icon eye"></i> 520
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="ui attached segment">
                    <!--图片区域 fluid 撑满外层容器-->
                    <img src="../static/images/example.jpg" th:src="@{/images/example.jpg}" alt="" class="ui fluid  rounded image">
                </div>
                <div class="ui attached segment padded">
                    <!--内容部分-->
                    <div class="ui right aligned basic segment">
                        <div class="ui orange basic label">原创</div>
                    </div>
                    <h1 class="ui horizontal divider header"><i class="tag icon"></i> 深度优先搜索刷题总结 </h1>

                    <br>
                    <div id="content"
                         class="js-toc-content typo typo-selection m-padded-lr-huge-responsive m-padded-tb">
                        <h1 id="候选人">de：</h1>
                        <p>给定一个<strong>无重复元素</strong>的数组 <code>candidates</code> 和一个目标数 <code>target</code> ，找出 <code>candidates</code>
                            中所有可以使数字和为 <code>target</code> 的组合。</p>
                        <p><code>candidates</code> 中的数字可以无限制重复被选取。</p>
                        <p><strong>说明：</strong></p>
                        <ul>
                            <li>所有数字（包括 <code>target</code>）都是正整数。</li>
                            <li>解集不能包含重复的组合。</li>
                        </ul>
                        <h2 id="候选人的起点选择">dede：</h2>


                        <h3 id="39-组合总和">39. dededede</h3>


                        <p>按照树形图的思路，我们每次选取一个数，t相应减去这个数，一旦t&lt;=0，表示终止条件，且t ==
                            0的时候，加入结果，但是这样做会有一个问题，我们可以看到有四个符合条件的结果：<code >[2, 2, 3], [2, 3, 2], [3, 2, 2], [7]</code>
                        </p>
                        <p>因为第一次选了223之后，当选到23之后，理应不能再回过头选2了，选了就重复了对吧。</p>
                        <p>我们又如何保证不重复呢？其实思路很好理解，首先将数组排序，保证数组的升序排序，<strong>每一次搜索的时候设置下一轮搜索的起点</strong>就可以了。</p>
                        <table summary="Typo.css 的测试平台列表">
                            <thead>
                            <tr>
                                <th>OS/浏览器</th>
                                <th>Firefox</th>
                                <th>Chrome</th>
                                <th>Safari</th>
                                <th>Opera</th>
                                <th>IE9</th>
                                <th>IE8</th>
                                <th>IE7</th>
                                <th>IE6</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>OS X</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                            </tr>
                            <tr>
                                <td>Win 7</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>-</td>
                            </tr>
                            <tr>
                                <td>Win XP</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>-</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>✔</td>
                            </tr>
                            <tr>
                                <td>Ubuntu</td>
                                <td>✔</td>
                                <td>✔</td>
                                <td>-</td>
                                <td>✔</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                                <td>-</td>
                            </tr>
                            </tbody>
                        </table>

                        <pre class="line-numbers"><code class="language-java">    public List&lt;Integer&gt; spiralOrder(int[][] mat) {
        List&lt;Integer&gt; res = new LinkedList&lt;&gt;();
        if(mat == null || mat.length == 0) return res;

        int m = mat.length, n = mat[0].length;
        int l = 0, r = n - 1, t = 0, b = m - 1;
        while(l &lt;= r &amp;&amp; b &gt;= t){
            for(int i = l; i &lt;= r; i ++) res.add(mat[t][i]);
            t ++;
    }
</code></pre>
                    </div>
                    <!--标签-->
                    <div class="m-padded-lr-huge m-padded-tb">
                        <div class="ui label teal mini basic">Java</div>
                    </div>

                    <div class="ui center aligned basic segment">
                        <!--赞赏-->
                        <div class="ui labeled button" tabindex="0">
                            <button id="payButton" class="ui inverted red button"><i class="heart icon"></i> 赞赏</button>

                        </div>
                        <div class="pay ui flowing popup transition hidden">
                            <div class="ui orange basic label">
                                <div class="ui images" style="font-size: inherit !important;">
                                    <div class="image">
                                        <img src="../static/images/pay/alipay.jpg" th:src="@{/images/pay/alipay.jpg}" class="ui rounded bordered image"
                                             alt="" style="width: 200px;">
                                        <div>支付宝</div>

                                    </div>
                                    <div class="image">
                                        <img src="../static/images/pay/wxpay.png" th:src="@{/images/pay/wxpay.png}" class="ui rounded bordered image"
                                             alt="" style="width: 200px;">
                                        <div>微信</div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>

                <div class="ui attached positive message">
                    <!--博客信息-->
                    <div class="ui grid middle aligned">
                        <div class="eleven wide column m-padded-lr-massive">
                            <ui class="list">
                                <li>作者: 天乔巴夏</li>
                                <li>发表时间 2020 09</li>
                                <li>版权声明 Java小白，从零单排。文章如果有叙述不当的地方</li>
                                <li>其他 当然，如果觉得文章对你有帮助 可以点个小小的推荐</li>
                            </ui>
                        </div>
                        <div class="five wide column">
                            <img src="../static/images/contact/wechat.dib" th:src="@{/images/contact/wechat.dib}" alt="二维码"
                                 class="ui right floated image rounded bordered">
                        </div>
                    </div>
                </div>
                <div class="ui bottom attached segment">
                    <!--留言区域-->
                    <div id="comment-container" class="ui teal segment">

                        <div class="ui comments">
                            <h3 class="ui dividing header">Comments</h3>
                            <div class="comment">
                                <a class="avatar">
                                    <img src="../static/images/example.jpg" th:src="@{/images/example.jpg}">
                                </a>
                                <div class="content">
                                    <a class="author">Matt</a>
                                    <div class="metadata">
                                        <span class="date">今天下午 5:42</span>
                                    </div>
                                    <div class="text">太赞了！</div>
                                    <div class="actions">
                                        <a class="reply">回复</a>
                                    </div>
                                </div>
                            </div>
                            <div class="comment">
                                <a class="avatar">
                                    <img src="../static/images/example.jpg">
                                </a>
                                <div class="content">
                                    <a class="author">Elliot Fu</a>
                                    <div class="metadata">
                                        <span class="date">昨天上午12:30</span>
                                    </div>
                                    <div class="text">
                                        <p>這對我的研究是非常有用.謝謝!</p>
                                    </div>
                                    <div class="actions">
                                        <a class="reply">回复</a>
                                    </div>
                                </div>
                                <div class="comments">
                                    <div class="comment">
                                        <a class="avatar">
                                            <img src="../static/images/example.jpg">
                                        </a>
                                        <div class="content">
                                            <a class="author">Jenny Hess</a>
                                            <div class="metadata">
                                                <span class="date">刚刚</span>
                                            </div>
                                            <div class="text">艾略特你永远是多么正确 :)</div>
                                            <div class="actions">
                                                <a class="reply">回复</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="comment">
                                <a class="avatar">
                                    <img src="../static/images/example.jpg">
                                </a>
                                <div class="content">
                                    <a class="author">Joe Henderson</a>
                                    <div class="metadata">
                                        <span class="date">5 天以前</span>
                                    </div>
                                    <div class="text">老兄，这太棒了。非常感谢。</div>
                                    <div class="actions">
                                        <a class="reply">回复</a>
                                    </div>
                                </div>
                            </div>


                        </div>
                        <div class="ui form">
                            <div class="field">
                                <textarea name="content" placeholder="请输入评论信息"></textarea>

                            </div>
                            <div class="fields">
                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <div class="ui left icon input">
                                        <i class="user icon"></i>
                                        <input type="text" name="nickName" placeholder="姓名">
                                    </div>
                                </div>
                                <div class="field m-mobile-wide m-margin-bottom-small">
                                    <div class="ui left icon input ">
                                        <i class="mail icon"></i>
                                        <input type="text" name="email" placeholder="邮箱">
                                    </div>
                                </div>
                                <div class="field m-mobile-wide m-margin-bottom-small ">
                                    <button class="ui teal button m-mobile-wide"><i class="edit icon"></i>发布</button>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!--页面插件-->
        <div id="toolbar"  class="m-padded m-fixed m-right-bottom" style="width: 120px;display: none;">
            <div class="ui vertical icon buttons " style="width: 100%">
                <button id="toc" href="#" type="button" class=" button ui teal button">目录</button>
                <a href="#comment-container" class="ui teal button ">留言</a>
                <button class="ui wechat teal icon button "><i class="weixin icon"></i></button>
                <div id="goToTop" class="ui teal button "><i class="icon chevron up"></i></div>
            </div>
        </div>
        <div class="toc-container ui flowing popup transition hidden" style="width: 250px;">
            <ol class="js-toc">

            </ol>
        </div>


        <!--扫码阅读-->
        <div id="scan-read" class="center aligned wechat-qr ui flowing popup transition hidden"
             style="width: 130px !important;">
            <!--<img src="./static/images/contact/wechat.dib" alt="" class="ui rounded image" style="width: 100px">-->
        </div>

        <!--底部-->
        <footer th:replace="_fragments::footer" class="ui inverted segment vertical m-padded-tb-massive m-padded-bottom-small">
            <div class="ui center aligned container">
                <!--16-->
                <div class="ui inverted divided stackable grid">
                    <div class="three wide column">
                        <div class="ui inverted link list">
                            <div class="item">
                                <img src="../static/images/contact/wechat.dib" th:src="@{/images/contact/wechat.dib}" alt="" class="ui rounded image"
                                     style="width: 110px">
                            </div>
                        </div>
                    </div>
                    <div class="three wide column">
                        <h4 class="ui inverted header m-opacity-mini">最新博客</h4>
                        <div class="ui inverted link list">
                            <a href="#" class="item">Leetcode 1 - 10</a>
                            <a href="#" class="item">Leetcode 1 - 10</a>
                            <a href="#" class="item">Leetcode 1 - 10</a>
                        </div>
                    </div>
                    <div class="three wide column">
                        <h4 class="ui inverted header m-opacity-mini">联系我</h4>
                        <div class="ui inverted link list">
                            <a href="#" class="item">Email: 1332790762@qq.com</a>
                            <a href="#" class="item">Phone: 123456789</a>
                        </div>
                    </div>
                    <div class="seven wide column">
                        <h4 class="ui inverted header m-opacity-mini">关于我</h4>
                        <p class="m-text-thin m-text-spaced m-opacity-mini">
                            Java小白，从零单排。文章如果有叙述不当的地方，还望评论区批评指正。当然，如果觉得文章对你有帮助，可以点个小小的推荐，或者关注我，一起交流，共同进步！</p>
                    </div>
                </div>
                <div class="ui inverted section divider"></div>
                <p class="m-text-thin m-text-spaced m-opacity-mini">Copyright ©2020 天乔巴夏 浙ICP备20020653号</p>
            </div>


        </footer>
        <th:block th:replace="_fragments::script">
        </th:block>
        <!--<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>-->
        <!--<script src="../static/js/jquery-3.5.1.min.js"></script>-->

        <!--<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>-->
        <!--<script src="../static/js/semantic.min.js"></script>-->
        <!--<script src="../static/libs/tocbot/tocbot.min.js" th:src="@{/libs/tocbot/tocbot.min.js}"></script>-->
        <!--<script src="../static/libs/scrollTo/jquery.scrollTo.min.js" th:src="@{/libs/scrollTo/jquery.scrollTo.min.js}"></script>-->
        <!--<script src="../static/js/prism.js" th:src="@{/js/prism.js}"></script>-->
        <!--<script src="../static/libs/qrcode/qrcode.min.js" th:src="@{/libs/qrcode/qrcode.min.js}"></script>-->
        <!--<script src="../static/libs/waypoints/jquery.waypoints.min.js" th:src="@{/libs/waypoints/jquery.waypoints.min.js}"></script>-->
        <script>
			$('#side').click(function () {
				$('.m-item').toggleClass('m-mobile-hide');
			})

			$('#payButton').popup({
				popup: $('.pay.popup'),
				on: 'click',
				position: 'top center'
			})

			$('#toc').popup({
				popup: $('.toc-container'),
				on: 'click',
				position: 'left center'
			})

			$('.wechat').popup({
				popup: $('.wechat-qr'),
				position: 'left center'
			})
            //自动生成目录
			tocbot.init({
				// Where to render the table of contents.
				tocSelector: '.js-toc',
				// Where to grab the headings to build the table of contents.
				contentSelector: '.js-toc-content',
				// Which headings to grab inside of the contentSelector element.
				headingSelector: 'h1, h2, h3'
			});
			//生成二维码
			var qrcode = new QRCode("scan-read", {
				//url
				text: "http://www.hyhwky.com",
				width: 110,
				height: 110,
				colorDark: "#000000",
				colorLight: "#ffffff",
				correctLevel: QRCode.CorrectLevel.H
			});

			//平滑滚动
			$("#goToTop").click(function () {
				$(window).scrollTo(0, 1000);
			})

            //侦测滚动
			var waypoint = new Waypoint({
				element: document.getElementById('waypoint'),
				handler: function(direction) {
					if(direction === "down"){
						$("#toolbar").show(500);
                    }else{
						$("#toolbar").hide(500);
                    }
				}
			})
        </script>
    </body>
</html>